<template>
  <div>
    <ul class="mui-table-view">
      <li class="mui-table-view-cell mui-media" v-for="item in newList" :key="item.id">
        <router-link :to="'/home/newList/' + item.id">
          <img class="mui-media-object mui-pull-left" :src="item.img_url" />
          <div class="mui-media-body">
            <h4>{{ item.title }}</h4>
            <p class="mui-ellipsis">
              <span>{{ item.add_time | dateFromt }}</span>
              <span>点击： {{ item.click }} 次</span>
            </p>
          </div>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      newList: []
    };
  },
  created() {
    this.getNewList();
  },
  methods: {
    getNewList() {
      this.$http
        .get("api/getnewslist")
        .then(res => {
          this.newList = res.data.message;
        });
    }
  }
};
</script>
<style lang="scss" scoped>
.mui-table-view {
  overflow-x: hidden;
  li {
    h4 {
      text-overflow: ellipsis;
      overflow: hidden;
    }
    .mui-ellipsis {
      font-size: 12px;
      color: #226aff;
      display: flex;
      justify-content: space-between;
    }
  }
}
</style>